package jupiter.node;

import jupiter.message.*;
import java.util.Hashtable;
import org.json.*;

public class GlobalNode {
	static private Hashtable<String, DomainNode> domainHash = new Hashtable<String, DomainNode>();
	
	static public JSONObject sendMessage(Message m){
		return getDomain(m.to() ).sendMessage(m);
	}
	static public DomainNode getDomain(Address a){
		DomainNode d = domainHash.get(a.domain());
		if(d == null){
			d = domainHash.put(a.domain(), new DomainNode(a));
		}
		return d;
	}
}
